package cn.le.bean.enums;

public enum EnumMsgCode {
    login(1,"用户登录"),
    exit(2,"用户退出"),
    point_send(3,"点发"),
    group_send(4,"群发"),
    heartbeat(5,"心跳"),
    resp_heartbeat(6,"心跳响应");
    private int code;
    private String text;

    //handler 处理类型
    public final static int handler_login = 1;
    public final static int handler_exit = 2;
    public final static int handler_point_send = 3;
    public final static int handler_heartbeat = 5;

    EnumMsgCode(int code,String text){
        this.code = code;
        this.text = text;
    }

    public boolean valueOf(int code){
        return this.code == code ? true : false;
    }

    public int getCode() {
        return code;
    }

    public static int getHandlerCode(EnumMsgCode enumMsgCode){
        return EnumMsgCode.valueOf(EnumMsgCode.class,enumMsgCode.text).getCode();
    }
}
